<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class LinkStoreRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'linkname' => 'required|min:2|max:15',
            'url' => 'required|url',
        ];
    }

    public function messages()
    {
        return [
            'linkname.required' => '网站名称不能为空',
            'linkname.min' => '网站名称最少2个字符',
            'linkname.max' => '网站名称最多15个字符',
            'url.required' => '网站的url不能为空',
            'url.url' => '网站格式填写不正确',
        ];
    }

}
